
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<f:view>
    <link href="/general/css/admin_1.css" rel="stylesheet" type="text/css"/>
    <t:div>

        <h:form>
            <h:panelGrid columns="1" width="100%" styleClass="tablaprincipal">
                <h:outputLabel value="Lista de Matriculados" />
            </h:panelGrid>
            <a4j:outputPanel ajaxRendered="true">
                <h:messages id="lblMessages" styleClass="messages" infoClass="infoClass" errorClass="errorClass"
                            warnClass="warnClass" showDetail="true" errorStyle="color:red;"
                            warnStyle="color:green;" infoStyle="color:black;" fatalStyle="color:black"/>
            </a4j:outputPanel>
            <h:panelGrid columns="4" styleClass="tablanormal">
                <h:outputLabel value="Curso / Diplomado: " />
                <h:selectOneMenu value="#{MatriculaController.codigoEvento}"
                                 onchange="submit();">
                    <f:selectItem itemValue="0" itemLabel="-- Seleccione un Curso --"/>
                    <f:selectItems value="#{PreEventoController.comboCursos}" />
                </h:selectOneMenu>
                <h:outputLabel value="Nota Mínima: " />
                <h:inputText value="#{MatriculaController.notaMinima}" disabled="true" size="5" maxlength="5" styleClass="etiquetaDerecha" />
            </h:panelGrid>
            <table width="100%" cellpadding="2" cellspacing="2" border="0" class="tablanormal">
                <tr>
                    <td align="right"><h:outputLabel value="#{MatriculaController.total}"/></td>
                </tr>
            </table>
            <rich:dataTable value="#{MatriculaController.listaMatricula}"
                            var="matricula" rows="10" reRender="ds,ds1" id="simpletable"
                            width="100%" columnsWidth="5%,60%,5%,10%,10%,10%">
                <rich:column breakBefore="true">
                    <f:facet name="header">
                        <h:outputLabel value="Codigo"/>
                    </f:facet>
                    <h:outputLabel value="#{matricula.codigo}"/>
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputLabel value="Alumno"/>
                    </f:facet>
                    <h:outputLabel value="#{matricula.nombreCompleto}" />
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputLabel value="Promedio"/>
                    </f:facet>
                    <h:outputLabel value="#{matricula.promedio}" />
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputLabel value="Dni"/>
                    </f:facet>
                    <h:outputLabel value="#{matricula.dni}" />
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputLabel value="Estado"/>
                    </f:facet>
                    <h:outputLabel value="#{matricula.status}" />
                </rich:column>
                <rich:column>
                    <f:facet name="header">
                        <h:outputLabel value="Eliminar Pre-Inscripcion"/>
                    </f:facet>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <h:commandButton value="Eliminar" title="Eliminar" image="/img/eliminar.png"
                                     rendered="#{matricula.estado == 0 ? 'true' : 'false'}"
                                     action="#{MatriculaController.eliminarInscripcion}"
                                     onclick="return confirm('Deseas eliminar la Pre-Inscripcion?');">
                        <f:setPropertyActionListener target="#{MatriculaController.matriculaAdapter}" value="#{matricula}" />
                    </h:commandButton>
                    <h:outputLabel value="----------" rendered="#{matricula.estado != 0 ? 'true' : 'false'}"/>
                </rich:column>
                <f:facet name="header">
                    <rich:datascroller id="ds" renderIfSinglePage="false"></rich:datascroller>
                </f:facet>
                <f:facet name="footer">
                    <rich:datascroller id="ds1" renderIfSinglePage="false"></rich:datascroller>
                </f:facet>
            </rich:dataTable>

            <h:panelGrid columns="2" styleClass="tablanormal">
                <h:commandButton value="Actualizar Promedios" styleClass="desactivar" accesskey="A"
                                 action="#{MatriculaController.actualizarPromedios}"/>
                <h:commandButton value="Exportar" styleClass="desactivar" accesskey="E"
                                 action="#{MatriculaController.exportar}"/>
            </h:panelGrid>
           
        </h:form>
    </t:div>
</f:view>
